﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.Utils;
using DevExpress.XtraEditors.Controls;

namespace HouseSecretary.Base
{
    public partial class MdiChildForm : GridChildForm
    {
  //private bool IsWriteLog = true;
        /// <summary>
        /// 不记录日志
        /// </summary>
        public MdiChildForm()
            : base()
        {  
            InitializeComponent();

            
        }
        /// <summary>
        /// 记录日志
        /// </summary>
        /// <param name="isWriteLog"></param>
        public MdiChildForm(bool isWriteLog)
            : base(isWriteLog)
        {
            //IsWriteLog = isWriteLog;
            InitializeComponent();


        }
        
        private void MdiChildForm_Load(object sender, EventArgs e)
        {
            if (!this.DesignMode)
            {
                InitToolButtons();
                AddBarItem();
            }
        }
        private void MdiChildForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            //if (IsWriteLog)
            //{
            //    //写日志

            //}
        }

        /// <summary>
        /// 初始化界面工具栏
        /// <creator>wangl</creator>
        /// <date>2011-12-22</date> 
        /// </summary>
        protected  virtual void InitToolButtons()
        {
             
        }

        ///// <summary>
        ///// 获取Mdi窗体的按钮集合
        ///// </summary>
        //protected BarItemLinkCollection GetBarMdiTools
        //{
        //    get
        //    {
        //        return barMdiTools.ItemLinks;
        //    }
        //}

        protected ImageCollection GetMdiImgCollectToolBar
        {
            get
            {
                return imgCollectToolBar;
            }
        }
        /// <summary>
        /// 增加窗体的工具栏  
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        private void AddBarItem()
        {
            if (this.Tag == null)
            {
                barMdiTools.Visible = false;
            }
            else
            {
                List<Model.Buttons> buttonsList = (List<Model.Buttons>)this.Tag;
                foreach (Model.Buttons buttonsModel in buttonsList)
                {
                    BarButtonItem barButton = new BarButtonItem();
                    //barButton.Name = ((int)buttonsModel.BtnType).ToString();
                    barButton.Caption = buttonsModel.BtnCaption;
                    barButton.Name = buttonsModel.BtnName;
                    barButton.ButtonStyle = BarButtonStyle.Default;
                    barButton.Border = BorderStyles.Default;
                    barButton.PaintStyle = BarItemPaintStyle.CaptionGlyph;
                    if (!string.IsNullOrEmpty( buttonsModel.BtnToolTip))
                    {
                        //按钮提示信息
                        SuperToolTip sToolTip = new SuperToolTip();
                        SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
                        args.Contents.Text = buttonsModel.BtnToolTip;
                        sToolTip.Setup(args);
                        sToolTip.AllowHtmlText = DefaultBoolean.True;
                        barButton.SuperTip = sToolTip;
                    }
                    switch (buttonsModel.BtnType)
                    {
                        case Model.ButtonType.add:
                            {
                                //增加
                                barButton.ImageIndex = base.GetImageIndex("button_add", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonAdd);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.delete:
                            {
                                //删除
                                barButton.ImageIndex = base.GetImageIndex("button_delete", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDelete);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.edit:
                            {
                                //修改，编辑
                                barButton.ImageIndex = base.GetImageIndex("button_edit", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonEdit);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.close:
                            {
                                //关闭
                                barButton.ImageIndex = base.GetImageIndex("button_close", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonClose);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.refresh:
                            {
                                //刷新
                                barButton.ImageIndex = base.GetImageIndex("button_refresh", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonRefresh);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.sendmsg:
                            {
                                //发送留言
                                barButton.ImageIndex = base.GetImageIndex("button_sendmsg", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonSendMsg);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.reply:
                            {
                                //回复
                                barButton.ImageIndex = base.GetImageIndex("button_reply", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonReply);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.detail:
                            {
                                //详细信息
                                barButton.ImageIndex = base.GetImageIndex("button_detail", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDetail);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.collect:
                            {
                                //收藏
                                barButton.ImageIndex = base.GetImageIndex("button_collect", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonCollect);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.query:
                            {
                                //查询
                                barButton.ImageIndex = base.GetImageIndex("button_query", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonQuery);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.queryAdvance:
                            {
                                //查询
                                barButton.ImageIndex = base.GetImageIndex("button_queryadvance", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonQueryAdvance);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.save:
                            {
                                //保存
                                barButton.ImageIndex = base.GetImageIndex("button_save", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonSave);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.saveAdd:
                            {
                                //保存并新增
                                barButton.ImageIndex = base.GetImageIndex("button_saveadd", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonSaveAdd);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.addEntry:
                            {
                                //增加明细
                                barButton.ImageIndex = base.GetImageIndex("button_addEntry", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonAddEntry);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.deleteEntry:
                            {
                                //删除明细
                                barButton.ImageIndex = base.GetImageIndex("button_deleteEntry", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDeleteEntry);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.look:
                            {
                                //查看
                                barButton.ImageIndex = base.GetImageIndex("button_look", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonLook);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.drawBack:
                            {
                                //收回
                                barButton.ImageIndex = base.GetImageIndex("button_drawback", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDrawBack);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.opinion:
                            {
                                //意见评价
                                barButton.ImageIndex = base.GetImageIndex("button_opinion", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonOpinion);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.assign:
                            {
                                //受理
                                barButton.ImageIndex = base.GetImageIndex("button_assign", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonAssign);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.dealWith:
                            {
                                //处理
                                barButton.ImageIndex = base.GetImageIndex("button_dealWith", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDealWith);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.check:
                            {
                                //审核
                                barButton.ImageIndex = base.GetImageIndex("button_check", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonCheck);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.praise:
                            {
                                //表扬
                                barButton.ImageIndex = base.GetImageIndex("button_praise", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonPraise);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.complain:
                            {
                                //投诉
                                barButton.ImageIndex = base.GetImageIndex("button_complain", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonComplain);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.addFriend:
                            {
                                //加好友
                                barButton.ImageIndex = base.GetImageIndex("button_addFriend", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonAddFriend);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.drawCircle:
                            {
                                //画圆
                                barButton.ImageIndex = base.GetImageIndex("button_drawcircle", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDrawCircle);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.drawRectangle:
                            {
                                //画矩形
                                barButton.ImageIndex = base.GetImageIndex("button_drawrectangle", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDrawRectangle);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.drawPolygon:
                            {
                                //画多边形
                                barButton.ImageIndex = base.GetImageIndex("button_drawpolygon", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDrawPolygon);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.drawPosition:
                            {
                                //标记位置
                                barButton.ImageIndex = base.GetImageIndex("button_drawposition", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDrawPosition);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.moveMap:
                            {
                                //移动地图
                                barButton.ImageIndex = base.GetImageIndex("button_movemap", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonMoveMap);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.transferEmployee:
                            {
                                //员工调动
                                barButton.ImageIndex = base.GetImageIndex("button_transferEmployee", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonTransferEmployee);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.restoreDefault:
                            {
                                //恢复默认值
                                barButton.ImageIndex = base.GetImageIndex("button_restoreDefault", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonRestoreDefault);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.editClient:
                            {
                                //修改联系人
                                barButton.ImageIndex = base.GetImageIndex("button_editClient", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonEditClient);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.selectRowAll:
                            {
                                //全部选中
                                barButton.ImageIndex = base.GetImageIndex("button_selectrowall", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonSelectRowAll);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.unselectRow:
                            {
                                //取消选中
                                barButton.ImageIndex = base.GetImageIndex("button_unselectrow", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonUnselectRow);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.inverseSelectRowAll:
                            {
                                //全部反选
                                barButton.ImageIndex = base.GetImageIndex("button_inverseselectrowall", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonInverseSelectRowAll);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.assignInfo:
                            {
                                //信息分配
                                barButton.ImageIndex = base.GetImageIndex("button_assignInfo", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonAssignInfo);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.leavePosition:
                            {
                                //离职处理
                                barButton.ImageIndex = base.GetImageIndex("button_leavePosition", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonLeavePosition);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.reinstatePosition:
                            {
                                //复职处理
                                barButton.ImageIndex = base.GetImageIndex("button_reinstatePosition", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonReinstatePosition);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.file:
                            {
                                //归档，包括房源归档、求购信息归档、合同归档
                                barButton.ImageIndex = base.GetImageIndex("button_file", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonFile);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.follow:
                            {
                                //归档，包括房源归档、求购信息归档、合同归档
                                barButton.ImageIndex = base.GetImageIndex("button_follow", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonFollow);
                                barMdiTools.AddItem(barButton);
                                break;
                            }


                        case Model.ButtonType.clear:
                            {
                                //房源查询，求购信息查询时，清空条件按钮
                                barButton.ImageIndex = base.GetImageIndex("button_clear", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonClear);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.queryMap:
                            {
                                //房源查询，求购信息查询时，清空条件按钮
                                barButton.ImageIndex = base.GetImageIndex("button_map", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonQueryMap);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.match:
                            {
                                //信息配对
                                barButton.ImageIndex = base.GetImageIndex("button_match", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonMatch);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.invitePartner:
                            {
                                //房源方发出的邀请合作
                                barButton.ImageIndex = base.GetImageIndex("button_invitePartner", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonInvitePartner);
                                barMdiTools.AddItem(barButton);
                                break;
                            }

                        case Model.ButtonType.lookHouseApply:
                            {
                                //求购方发出的看房申请
                                barButton.ImageIndex = base.GetImageIndex("button_lookhouseapply", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonLookHouseApply);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.delay:                            {
                                //延迟开放房源
                                barButton.ImageIndex = base.GetImageIndex("button_delay", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDelay);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.stopCooperation:
                            {
                                //中止合作
                                barButton.ImageIndex = base.GetImageIndex("button_stopCooperation", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonStopCooperation);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.lookHouseRemind:
                            {
                                //看房提醒
                                barButton.ImageIndex = base.GetImageIndex("button_lookHouseRemind", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonLookHouseRemind);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.lookHouseFeedback:
                            {
                                //看房反馈
                                barButton.ImageIndex = base.GetImageIndex("button_lookHouseFeedback", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonLookHouseFeedback);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.rentsaleRemind:
                            {
                                //已租售房源提醒
                                barButton.ImageIndex = base.GetImageIndex("button_rentsaleRemind", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonRentSaleRemind);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.print:
                            {
                                //打印
                                barButton.ImageIndex = base.GetImageIndex("button_print", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonPrint);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.associatedInfo:
                            {
                                //关联信息查询
                                barButton.ImageIndex = base.GetImageIndex("button_associatedInfo", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonAssociatedInfo);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.clearMatch:
                            {
                                //清除配对信息
                                barButton.ImageIndex = base.GetImageIndex("button_clearMatch", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonClearMatch);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.dontPrint:
                            {
                                //清除配对信息
                                barButton.ImageIndex = base.GetImageIndex("button_dontPrint", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDontPrint);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.invalid:
                            {
                                //作废
                                barButton.ImageIndex = base.GetImageIndex("button_del", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonInvalid);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.exportExcel:
                            {
                                //导出EXCEL
                                barButton.ImageIndex = base.GetImageIndex("button_exportExcel", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonExportExcel);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.dontArchive:
                            {
                                //暂不归档
                                barButton.ImageIndex = base.GetImageIndex("button_dontArchive", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDontArchive);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.preArchive:
                            {
                                //预归档
                                barButton.ImageIndex = base.GetImageIndex("button_preArchive", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonPreArchive);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.archive:
                            {
                                //归档
                                barButton.ImageIndex = base.GetImageIndex("button_archive", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonArchive);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.backPreArchive:
                            {
                                //取消预归档
                                barButton.ImageIndex = base.GetImageIndex("button_backPreArchive", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonBackPreArchive);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.upload:
                            {
                                //上传
                                barButton.ImageIndex = base.GetImageIndex("button_upload", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonUpload);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.createDir:
                            {
                                //新建文件夹
                                barButton.ImageIndex = base.GetImageIndex("button_createDir", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonCreateDir);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.downLoad:
                            {
                                //下载
                                barButton.ImageIndex = base.GetImageIndex("button_downLoad", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonDownLoad);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.reName:
                            {
                                //重命名
                                barButton.ImageIndex = base.GetImageIndex("button_reName", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonReName);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.move:
                            {
                                //移动
                                barButton.ImageIndex = base.GetImageIndex("button_move", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonMove);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                        case Model.ButtonType.copy:
                            {
                                //复制到
                                barButton.ImageIndex = base.GetImageIndex("button_copy", imgCollectToolBar);
                                barButton.ItemClick += new ItemClickEventHandler(ButtonCopy);
                                barMdiTools.AddItem(barButton);
                                break;
                            }
                    }
                }
            }
            

        }

        /// <summary>
        /// [已过时]设置按钮的Enabled属性
        /// <creator>wangl</creator>
        /// <date>2011-12-23</date>
        /// </summary>
        /// <param name="buttonName">按钮的text值</param>
        /// <param name="enabled">是否可用</param>
        ///[Obsolete("已过时,请选用SetButtonEnabledByName方法")]
        protected void SetButtonsEnabled(string buttonCaption, bool enabled)
        {
            for (int i = 0; i < barMainManager.Items.Count; i++)
            {
                if (barMainManager.Items[i].Caption == buttonCaption)
                {
                    barMainManager.Items[i].Enabled = enabled;
                    break;
                }
               
            }
        }
        protected BarItem GetBarItem(string buttonCaption)
        {
            BarItem bi = null;
            for (int i = 0; i < barMainManager.Items.Count; i++)
            {
                if (barMainManager.Items[i].Caption == buttonCaption)
                {
                    bi = barMainManager.Items[i];
                    break;
                }

            }
            return bi;
        }
        /// <summary>
        /// 设置按钮的Enabled属性 (根据名字)
        /// <creator>wangl</creator>
        /// <date>2012-04-16</date>
        /// </summary>
        /// <param name="buttonName"></param>
        /// <param name="enabled"></param>
        protected void SetButtonEnabledByName(string buttonName, bool enabled)
        {
            for (int i = 0; i < barMainManager.Items.Count; i++)
            {
                if (barMainManager.Items[i].Name == buttonName)
                {
                    barMainManager.Items[i].Enabled = enabled;
                    break;
                }

            }
        }
        /// <summary>
        /// 设置按钮的文本
        /// <creator>wangl</creator>
        /// <date>2012-04-16</date>
        /// </summary>
        /// <param name="buttonName"></param>
        /// <param name="buttonCaption"></param>
        protected void SetButtnCaption(string buttonName, string buttonCaption)
        {
            for (int i = 0; i < barMainManager.Items.Count; i++)
            {
                if (barMainManager.Items[i].Name == buttonName)
                {
                    barMainManager.Items[i].Caption = buttonCaption;
                    break;
                }

            }
        }
        /// <summary>
        /// 设置按钮imageList中的imageIndex
        /// <creator>wangl</creator>
        /// <date>2012-04-16</date> 
        /// </summary>
        /// <param name="imgName"></param>
        /// <returns></returns>
        protected void SetButtonImageIndex(string buttonName, string imgName, ImageCollection imgCollect)
        {
            for (int i = 0; i < barMainManager.Items.Count; i++)
            {
                if (barMainManager.Items[i].Name == buttonName)
                {
                    Image img = imgCollect.Images[imgName];
                    for (int j = 0; j < imgCollect.Images.Count; j++)
                    {
                        if (imgCollect.Images[j] == img)
                        {
                            barMainManager.Items[i].ImageIndex = j;
                            break;
                        }

                    }
                    break;
                }

            }

        }
        /// <summary>
        /// 点击保存按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonSave(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击保存并新增按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonSaveAdd(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击查询按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonQuery(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击高级查询按钮事件
        /// <creator>wangzb</creator>
        /// <date>2012-03-03</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonQueryAdvance(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击收藏按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonCollect(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击详细信息按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDetail(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击回复按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonReply(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击增加按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonAdd(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 点击删除按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDelete(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击增加明细按钮事件
        /// <creator>wangzb</creator>
        /// <date>2011-12-29</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonAddEntry(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 点击删除明细按钮事件
        /// <creator>wangzb</creator>
        /// <date>2011-12-29</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDeleteEntry(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击修改、编辑按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonEdit(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击关闭按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonClose(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 点击刷新按钮事件
        /// <creator>wangl</creator>
        /// <date>2011-12-17</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonRefresh(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 点击发送留言按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonSendMsg(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 点击查看按钮事件，一般用于查看详细资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonLook(object sender, ItemClickEventArgs e)
        {

        }
 
        /// <summary>
        /// 点击收回按钮事件，一般用于查看详细资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDrawBack(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 点击评价按钮事件，一般用于查看详细资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonOpinion(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击受理按钮事件，一般用于查看详细资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonAssign(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击处理按钮事件，一般用于查看详细资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDealWith(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 点击审核按钮事件，一般用于查看详细资料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonCheck(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 表扬按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonPraise(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 投诉按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonComplain(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 加好友 按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonAddFriend(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 画圆按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDrawCircle(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 画矩形按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDrawRectangle(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 画多边形按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDrawPolygon(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 标记位置按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDrawPosition(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 移动地图按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonMoveMap(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 员工调动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonTransferEmployee(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 恢复默认值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonRestoreDefault(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 修改联系人
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonEditClient(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 全部选中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonSelectRowAll(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 取消选中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonUnselectRow(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 全部反选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonInverseSelectRowAll(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 信息分配
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonAssignInfo(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 离职处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonLeavePosition(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 复职处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonReinstatePosition(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 归档，包括房源归档、求购信息归档、合同归档
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonFile(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 联系跟进，房源跟进，求购信息跟进，合作跟进
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonFollow(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 房源查询，求购信息查询时，清空条件按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonClear(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 求购信息，房源信息按地图查询按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonQueryMap(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 信息配对
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonMatch(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 房源方发出的邀请合作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonInvitePartner(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 求购方发出的合作请求
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonLookHouseApply(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 延迟开放房源
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDelay(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 中止合作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonStopCooperation(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 延迟开放房源
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonLookHouseRemind(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 延迟开放房源
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonLookHouseFeedback(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 已租售房源提醒
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonRentSaleRemind(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonPrint(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 关联信息查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonAssociatedInfo(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 清除配对信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonClearMatch(object sender, ItemClickEventArgs e)
        {

        }
    
        /// <summary>
        /// 取消打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDontPrint(object sender, ItemClickEventArgs e)
        {

        }
        /// <summary>
        /// 作废
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonInvalid(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonExportExcel(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 暂不归档
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDontArchive(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 预归档
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonPreArchive(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 归档
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonArchive(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 取消预归档
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonBackPreArchive(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 上传
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonUpload(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 新建文件夹
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonCreateDir(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonDownLoad(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 重命名
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonReName(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 移动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonMove(object sender, ItemClickEventArgs e)
        {

        }

        /// <summary>
        /// 复制到
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void ButtonCopy(object sender, ItemClickEventArgs e)
        {

        }


    }
}
